<!DOCTYPE html>
<html lang="en">
<head>
	<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
	<meta charset="UTF-8">
	<title>升值链</title>
	<meta name="description" content="">
	<meta name="keywords" content="">
	<meta name="viewport" content="initial-scale=1, width=device-width, maximum-scale=1, user-scalable=no">
	<meta name="format-detection" content="telephone=no,email=no,adress=no" />
	<meta name="apple-mobile-web-app-capable" content="yes" />  
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
	<link rel="stylesheet" href="{THEME_PATH}styles/swiper.min.css">
	<link rel="stylesheet" href="{THEME_PATH}styles/reset.css">
	<link rel="stylesheet" href="{THEME_PATH}styles/common.css">
	<link rel="stylesheet" href="{THEME_PATH}styles/style.css">
	<script src="{THEME_PATH}js/jquery-1.8.3.min.js"></script>
	<script src="{THEME_PATH}js/swiper.min.js"></script>
	<script src="/statics/js/layer/layer.js"></script>
</head>
<body>
	<!-- S header -->
	<header>
		<a href="/index.php?m=user&c=home&a=index" class="headerL iconfont">&#xe69f;</a>
		<h1>升值链</h1>
		
	</header>
	<!-- E header -->
	<dl class="sendTo shengzhi">
		<dt>当前升值链</dt>
		<span id="span"></span>
		<dd class="number"><?php echo $user_info['upvaluation']; ?> GF</dd>
	</dl>
	<div class="input-convert">
		<input type="text" placeholder="请输入数量" name="number">
	</div>
	
	<a href="javascript:;" class="btn" onclick="payment()">回收升值链</a>
	
	<!-- <a href="javascript:;" class="btn recycle-btn" onclick="payment1()">回收升值链</a> -->
	
	<div class="popup_shade"></div>
	<!-- S 付款弹窗 -->
	<div class="payment_popUp">
		<div class="flex flex-pack-justify card-wrap">
			<label>储蓄卡</label>
			<div class="numb"><?php echo $bank_info['bank_type']; ?>（<?php echo substr($bank_info['bank_number'],-4,4); ?>）</div>
		</div>
		<dl class="money">
			<dt>GF</dt>
			<dd style="margin-top: 0;" class="dd_price">23.30</dd>
		</dl>
		<div class="transaction-password">
			<h3>请输入交易密码</h3>
			<div class="password-wrap flex flex-pack-justify">
			<input type="password" maxlength="1" name="password_1" onkeyup="this.value=this.value.replace(/\D/g,'')">
				<input type="password" maxlength="1" name="password_2" onkeyup="this.value=this.value.replace(/\D/g,'')">
				<input type="password" maxlength="1" name="password_3" onkeyup="this.value=this.value.replace(/\D/g,'')">
				<input type="password" maxlength="1" name="password_4" onkeyup="this.value=this.value.replace(/\D/g,'')">
				<input type="password" maxlength="1" name="password_5" onkeyup="this.value=this.value.replace(/\D/g,'')">
				<input type="password" maxlength="1" name="password_6" onkeyup="this.value=this.value.replace(/\D/g,'')">
			</div>
		</div>
		
		<a href="javascript:;" class="btn submit">提交</a>
	</div>
	<!-- E 付款弹窗 -->
	
	
	<script>

		//付款
		function payment(){
			var number = $("input[name='number']").val();
			if(!number){
				layer.msg('请输入数量');
				return;
			}
			$('#span').text(1);
			$('.dd_price').text(number*2);
			$(".popup_shade,.payment_popUp").show();
			

		}
		$('.submit').click(function(){
				var password_1 = $("input[ name='password_1' ] ").val();
				var password_2 = $("input[ name='password_2' ] ").val();
				var password_3 = $("input[ name='password_3' ] ").val();
				var password_4 = $("input[ name='password_4' ] ").val();
				var password_5 = $("input[ name='password_5' ] ").val();
				var password_6 = $("input[ name='password_6' ] ").val();
				if(password_1 === ''||password_2 === '' || password_3 === ''|| password_4 === '' || password_5 === '' || password_6 === ''){
					layer.msg('不能为空');
					setTimeout(function(){
								location.reload();
							},1000);
					return;
				}
				var password = password_1+""+password_2+""+password_3+""+password_4+""+password_5+""+password_6;
				var number = $("input[name='number']").val();
				if($('#span').text() == 1){
					$.ajax({
						url:"/index.php/?m=user&c=home&a=exchange_upvaluation",
						type:'post',
						data:{password:password,number:number},
						dataType:'json',
						success:function(data){
							if(data.status ==0){
								layer.msg(data.info);
								setTimeout(function(){
									location.reload();
								},1000);
							}else{
								// $(".popup_shade,#payment_popUp").hide();
								// $(".popup_shade,#success").show();
								layer.msg(data.info);
								setTimeout(function(){
								// location.href = "/index.php?m=user&c=trade&a=index";
								window.location.reload();
								},1000);
						
								// layer.close(index);
								return;
							}
						}
					});
				}else if($('#span').text() == 2){
					var id = "<?php echo $bank_info['id']; ?>";
					$.ajax({
						url:"/index.php/?m=user&c=home&a=huishou",
						type:'post',
						data:{password:password,number:number,id:id},
						dataType:'json',
						success:function(data){
							if(data.status ==0){
								layer.msg(data.info);
								setTimeout(function(){
									location.reload();
								},1000);
							}else{
								// $(".popup_shade,#payment_popUp").hide();
								// $(".popup_shade,#success").show();
								layer.msg(data.info);
								setTimeout(function(){
								// location.href = "/index.php?m=user&c=trade&a=index";
								window.location.reload();
								},1000);
						
								// layer.close(index);
								return;
							}
						}
					});
				}
				
			})
			function payment1(){
			var number = $("input[name='number']").val();
			if(!number){
				layer.msg('请输入数量');
				return;
			}
			 
			$('.dd_price').text(number);
		
			$('#span').text(2);
			$(".popup_shade,.payment_popUp").show();
			

		}
	</script>
</body>